#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main() {
	int arr[20] = { 0 };
	int n = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &arr[i]);
	}
	for (int i = 0; i < 5; i++) {
		int max = 0;
		int index = -1;
		for (int j = 0; j < n; j++) {
			if (arr[j] > max) {
				max = arr[j];
				index = j;
			}
		}
        printf("%d\n", max);
		arr[index] = 0;
		}
	return 0;
}
	

